#include "log_op.h"
#include "divide_op.h"
#include "../../factory/factory.h"
#include "../../factory/divide_factory.h"

Log::Log(Node* node) : OpNode({node}){
}

vector<Node*> Log::getGradNodes(Node* grad){
    auto nodes = *getNodeIn();
    Factory* factory = new DivideFactory(grad, nodes[0]);
    Node* ret = factory -> createNode();
    delete factory;
    return { ret };
}

void Log::compute(Context* context){
    auto nodes = *getNodeIn();
    context -> setFlowedData(this, 
            log(context -> getFlowedData(nodes[0]))); 
}
